<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <title>个人资料</title>
    <link rel="stylesheet" type="text/css" href="__CSS__/api.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/tt.css" />

    <style>
        html {
            background: rgba(243, 245, 246, 1);
        }
        .hidden{
            display: none;
        }

        body {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
            background: rgba(243, 245, 246, 1);
        }

        .top {
            width: 100%;
            height: 80px;
            background: rgba(255, 255, 255, 1);
        }

        .top_box {
            width: 1180px;
            height: 100%;
            margin: 0 auto;
            align-items: center;
        }

        .top_logo {
            width: 122px;
            height: 32px;
            margin-right: 78px;
        }

        .top_label {
            position: relative;
            height: 80px;
            line-height: 80px;
            font-size: 16px;
            font-weight: 400;
            color: rgba(51, 51, 51, 1);
            margin-right: 48px;
        }

        .top_label_active::after {
            position: absolute;
            content: '';
            display: block;
            height: 4px;
            width: 32px;
            left: 0;
            right: 0;
            margin: auto;
            background-color: #FC2B40;
            bottom: 17px;
        }

        .top_down {
            display: inline-block;
            width: 8px;
            height: 8px;
            min-height: 8px;
            width: 8px;
            background: url(__IMG__/down.png) no-repeat center center;
            background-size: 8px 8px;
            margin-left: 4px;
        }

        .top_avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            margin-right: 8px;
        }

        .top_name {
            font-size: 16px;
            font-weight: 400;
            color: rgba(51, 51, 51, 1);
        }

        .top_notice {
            width: 24px;
            height: 24px;
            margin-left: 58px;
        }

        .xydd {
            width: 240px;
            height: 38px;
            background: rgba(252, 43, 64, 1);
            border-radius: 4px;
            font-size: 16px;
            color: rgba(255, 255, 255, 1);
            line-height: 38px;
            text-align: center;
            margin: 24px auto;
        }

        .out {
            background-color: #fff;
            padding: 40px 40px 32px;
            width: 1180px;
            margin: 40px auto;
            box-sizing: border-box;
        }

        .gsjj {
            font-size: 22px;
            font-weight: 600;
            color: rgba(51, 51, 51, 1);
            line-height: 30px;
        }

        .l_img {
            width: 20px;
            height: 20px;
            position: relative;
            top: 2px;
            margin-right: 5px;
        }

        .mid {
            width: 390px;
            margin: 56px auto 0;
        }

        input[type="text"],
        input[type="tel"] {
            height: 32px;
            margin: 0;
            padding: 0 12px;
            font-size: 14px;
            color: #666666;
            background: transparent;
            outline: none;
            font-family: sans-serif;
        }

        input::-webkit-input-placeholder,
        textarea::-webkit-input-placeholder {
            color: #CCCCCC;
        }

        .one {
            align-items: center;
            margin-bottom: 24px;
        }

        .left {
            width: 90px;
            font-size: 16px;
            font-weight: 400;
            color: #666666;
        }

        .kuang {
            width: 300px;
            height: 32px;
            border-radius: 4px;
            border: 1px solid rgba(221, 221, 221, 1);
            align-items: center;
            padding-right: 12px;
            font-size: 12px;
            font-weight: 400;
            color: rgba(204, 204, 204, 1);
            position: relative;
        }

        .btn {
            width: 88px;
            height: 32px;
            background: rgba(252, 43, 64, 1);
            border-radius: 4px;
            font-size: 14px;
            color: rgba(255, 255, 255, 1);
            line-height: 32px;
            margin: 54px auto 0;
            text-align: center;
        }

        .headerr {
            width: 90px;
            height: 90px;
            display: block;
            border-radius: 50%;
            margin: auto;
            cursor: pointer;
        }

        .geng_tou {
            font-size: 14px;
            font-weight: 600;
            color: rgba(153, 153, 153, 1);
            line-height: 20px;
            text-align: center;
            margin-top: 10px;
        }

        .info {
            font-size: 16px;
            font-weight: 600;
            color: rgba(51, 51, 51, 1);
            line-height: 22px;
            margin: 64px 0 24px 60px;
        }

        .outtt {
            padding: 0 102px;
        }

        .down {
            width: 12px;
            height: 8px;
        }

        .one1 {}

        .texttt {
            width: 300px;
            height: 208px;
            border-radius: 4px;
            border: 1px solid rgba(221, 221, 221, 1);
            box-sizing: border-box;
            padding: 10px 11px;
            outline: none;
            font-size: 14px;
            color: #666666;
            resize: none;
            font-family: sans-serif;
        }

        .top_card1{
            position: absolute;
            top:33px;
            left:0;
            width:170px;
            background:#fff;
            border-radius:4px;
            z-index:99;
            font-size:14px;
            font-weight:400;
            overflow: hidden;
            -webkit-box-shadow:0px 0px 10px rgba(0,0,0,0.2);
        }
        .top_card2{
            height:40px;
            line-height:40px;
            background:rgba(255,255,255,1);;
            color:rgba(102,102,102,1);
            padding-left:16px;
        }
        .top_card_active{
            height:40px;
            line-height:40px;
            background:rgba(252,43,64,0.1);
            color:rgba(252,43,64,1);
        }

        #order,
        #about,
        #user {
            display: none;
        }
        .top_card{
            position: relative;
        }
    </style>
</head>

<body>
{include file="public/header"}

<form class="form" id="formImg">
  <div class="out">
      <input type="file" accept="image/*" id="fileimg" onChange="previewimg(this)" style="display:none;" name ="input_image" >
      <img src="{$res.user_image}" alt="" class="headerr">
      <input type="hidden" name="user_image" id="userimg" value="{$res.user_image}" />
    <div class="geng_tou">更换头像</div>
    <div class="info">基本资料</div>
    <div class="outtt  flex-wrap">
        <!-- <div class="gsjj"><img src="__IMG__/left.png" alt="" class="l_img">申请成为小易嘀达合伙人</div> -->
        <div class="mid">
            <div class="one flex-wrap">
                <div class="left">真实姓名</div>
                <div class="kuang flex-wrap">
                    <input type="text" value="{$res.user_real_name}" name="user_real_name" placeholder="请输入真实姓名" class="flex-con" >
                    <!-- <img src="__IMG__/down1.png" class="down"> -->
                </div>
            </div>
            <div class="one flex-wrap">
                <div class="left">性别</div>
                <div class="kuang flex-wrap">
                    <input type="text" id="sex1" value="{$res.sex}" name="user_gender" onclick="show1()"  placeholder="请选择性别" class="flex-con"  readonly>
                    <img src="__IMG__/down1.png" class="down">
                    <div class="top_card1  hidden" id="cardddd">
                        <div class="top_card2 top_card_active" onclick="choose(this)" idd="男">男</div>
                        <div class="top_card2" onclick="choose(this)" idd="女">女</div>
                        <div class="top_card2" onclick="choose(this)" idd="未知">未知</div>
                    </div>
                </div>
            </div>
            <div class="one flex-wrap">
                <div class="left">手机号</div>
                <div class="kuang flex-wrap">
                    <input type="text" value="{$res.user_phone}"  name="user_phone" id="user_phone" placeholder="请输入手机号" class="flex-con">
                    <!-- <img src="__IMG__/down1.png" class="down"> -->
                </div>
            </div>
            <div class="one flex-wrap">
                <div class="left">所在公司</div>
                <div class="kuang flex-wrap">
                    <input type="text" value="{$res.user_gongsi}" name="user_gongsi" placeholder="请输入所在公司" class="flex-con" >
                    <!-- <img src="__IMG__/down1.png" class="down"> -->
                </div>
            </div>
            <div class="one flex-wrap">
                <div class="left">职务</div>
                <div class="kuang flex-wrap">
                    <input type="text" value="{$res.user_zhiwu}" name="user_zhiwu" placeholder="请输入职务" class="flex-con">
                    <!-- <img src="__IMG__/down1.png" class="down"> -->
                </div>
            </div>
            <div class="one flex-wrap">
                <div class="left">邮箱账号</div>
                <div class="kuang flex-wrap">
                    <input type="text" value="{$res.user_email}" id="user_email" name="user_email" placeholder="请输入邮箱账号" class="flex-con" >
                </div>
            </div>

        </div>
        <div class="flex-con"></div>
        <div class="mid">
            <div class="one flex-wrap">
                <div class="left">用户昵称</div>
                <div class="kuang flex-wrap">
                    <input type="text" value="{$res.user_username}" name="user_username" placeholder="请输入用户昵称" class="flex-con">
                </div>
            </div>
            <div class="one flex-wrap">
                <div class="left">QQ号</div>
                <div class="kuang flex-wrap">
                    <input type="tel" value="{$res.user_qq}" name="user_qq" placeholder="请输入QQ号" class="flex-con" >
                    <!-- <img src="__IMG__/down1.png" class="down"> -->
                </div>
            </div>
            <div class="one1 flex-wrap">
                <div class="left" style="padding-top:7px;">个人简介</div>
                <textarea class="flex-con texttt" name="user_grjj" rows="8" cols="10" placeholder="请输入个人简介">{$res.user_grjj}</textarea>
            </div>
        </div>
    </div>
    <div class="btn" onclick="tijiao()">保存</div>
 </div>
</form>

</body>
<script type="text/javascript" src="__SCRIPT__/xydd.js"></script>
<script type="text/javascript" src="__SCRIPT__/api.js"></script>
<script src="/static/admin/js/jquery.min.js"></script>
<script>
    $('.headerr').click(function () {
        $('#fileimg').click();
    });
    function previewimg(obj){
        var src = window.URL.createObjectURL(obj.files[0]);
        $('.headerr').attr('src',src);
        //此方法已封装在xydd.js里
        uploadImageCommon('formImg','userimg');
    }
</script>
<script>
    function choose(el){
        var name=$api.attr(el,'idd');
//        alert(name);
        $api.byId('sex1').value=name;
        $api.addCls($api.byId('cardddd'),'hidden');
        var aaa=$api.domAll('.top_card2');
        for(var i=0;i<aaa.length;i++){
            $api.removeCls(aaa[i],'top_card_active');
        }

        $api.addCls(el,'top_card_active');
    }
    function show1() {
        if($api.hasCls($api.byId('cardddd'),'hidden')){
            $api.removeCls($api.byId('cardddd'),'hidden');
        }else{
            $api.addCls($api.byId('cardddd'),'hidden');
        }
    }
    function tijiao() {
        var pattern = /^1[23456789]\d{9}$/;
        if(!pattern.test($('#user_phone').val())){
            alert('请输入正确的手机号');
            return false;
        }
        var pattern1 = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
        if(!pattern1.test($('#user_email').val())){
            alert('请输入正确的邮箱号');
            return false;
        }
        $.ajax({
            url:"{:url('shop/my/index')}",
            type:'post',
            data:$('.form').serialize(),
            dataType:'json',
            success:function(res){
                if(res.status != 200){
                    alert(res.msg);
                    location.reload() ;
                    return false;
                }else{
                    window.location.href='/shop/first/index';
                }
            }
        })
    }

</script>


</html>
